# -*- coding: utf-8 -*-#

# -------------------------------------------------------------------------------
# Name:         db_config
# Description:  config
# Author:       yhm
# Date:         2020/9/29
# -------------------------------------------------------------------------------
import os
from easydict import EasyDict as edict

cfg = edict()
cfg.root = './logs3'

cfg.TRAIN = edict()
cfg.TRAIN.FLAG = True
#
# 训练
cfg.TRAIN.VIS_GPU = '0'
cfg.TRAIN.BATCH_SIZE = 8
cfg.TRAIN.MAX_STEPS = 10000000
cfg.TRAIN.LEARNING_RATE = 0.007
cfg.TRAIN.LOSS_ALPHA = 1.0
cfg.TRAIN.LOSS_BETA = 10.0
# cfg.TRAIN.OPT = 'SGD'

# 存储目录
cfg.TRAIN.SAVE_CHECKPOINT_STEPS = 2000
cfg.TRAIN.SAVE_SUMMARY_STEPS = 200
cfg.TRAIN.SAVE_MAX = 1000
cfg.TRAIN.DATA_DIR = './datasets/total_text'
cfg.TRAIN.TRAIN_LOGS = os.path.join(cfg.root, 'tf_logs')
cfg.TRAIN.CHECKPOINTS_OUTPUT_DIR = os.path.join(cfg.root, 'ckpt')

# cfg.TRAIN.TRAIN_LOGS = os.path.join(os.path.abspath(os.path.curdir), 'tf_logs')
# cfg.TRAIN.CHECKPOINTS_OUTPUT_DIR = os.path.join(os.path.abspath(os.path.curdir), 'ckpt')

# dataload
cfg.MEANS = [122.67891434, 116.66876762, 104.00698793]
cfg.EPSILON_RATIO = 0.001
cfg.SHRINK_RATIO = 0.4
cfg.THRESH_MIN = 0.3
cfg.THRESH_MAX = 0.7
cfg.TRAIN.IMG_SIZE = 640
cfg.TRAIN.MIN_TEXT_SIZE = 8

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~super em~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cfg.TRAIN.LEARNING_RATE = 0.0001
cfg.TRAIN.OPT = 'adam'  # 'momentum'#
cfg.TRAIN.MOVING_AVERAGE_DECAY = 0.9

cfg.TRAIN.RESTORE = None
cfg.TRAIN.RESTORE_CKPT_PATH = os.path.join(cfg.root, 'ckpt')
# cfg.TRAIN.RESTORE_CKPT_PATH = os.path.join(os.path.abspath(os.path.curdir), 'ckpt')
cfg.TRAIN.PRETRAINED_MODEL_PATH = None

cfg.EVAL = edict()
cfg.EVAL.NUM_READERS = 1
cfg.EVAL.TEST_STEP = 200

cfg.EVAL.IMG_DIR = './datasets/total_text/test_images'
cfg.EVAL.LABEL_DIR = './datasets/total_text/test_gts'
# cfg.EVAL.IMG_DIR = './datasets/total_text/train_images'
# cfg.EVAL.LABEL_DIR = './datasets/total_text/train_gts'

cfg.K = 50
cfg.BACKBONE = 'resnet_v1_50'
cfg.ASPP_LAYER = False
cfg.MEANS = [122.67891434, 116.66876762, 104.00698793]
cfg.FILTER_MIN_AREA = 1e-4
